package com.example.mapper;

import com.example.model.WxbGood;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Set;

public interface WxbGoodsMapper extends Mapper<WxbGood> {

//    @Select(value = "select count(1) from wxb_good")
//    public Integer count;

    @Select(value = "select g.*,c.customer_id,c.customer_name from wxb_good g inner join wxb_customer c on g.customer_id = c.customer_id limit #{start},#{pageSize}")
    public List<WxbGood> listGoods(@Param("start")int start,
                                   @Param("pageSize") int pageSize);

    @Select(value = "select g.*,c.customer_id,c.customer_name from wxb_good g inner join wxb_customer c on g.customer_id = c.customer_id where g.type_id=#{typeId} limit #{start},#{pageSize}")
    public List<WxbGood> listGoodsByType(@Param("typeId") String typeId,
                                         @Param("start") int start,
                                         @Param("pageSize") int pageSize);


    @Update(value = "update wxb_good set state = #{state} where good_id = #{goodId}")
    public void updateState(@Param("state") int state,
                            @Param("goodId") String goodId);

}
